package me.zhulu.drools.wac.loan;

import org.apache.commons.lang3.time.DateUtils;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: herosea
 * Date: 14-7-18
 * Time: 上午11:49
 * To change this template use File | Settings | File Templates.
 */
public class Today {

    private Date time = new Date();

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    /**
     * date 在 amount 个月之内
     * @param date
     * @param amount
     * @return
     */
    public boolean inMonths(Date date, int amount) {
        Date startDate = DateUtils.addMonths(time, -amount);
        return startDate.before(date) && date.before(time);
    }
}
